package com.cd2cd.mapper;

import com.cd2cd.domain.ProTableColumn;
import com.cd2cd.mapper.gen.SuperProTableColumnMapper;
import com.cd2cd.vo.ProTableColumnVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface ProTableColumnMapper extends SuperProTableColumnMapper {
    @Select("select name,comment,mysql_type as mysqlType from pro_table_column where table_id =#{tableId}")
    List<ProTableColumn> selectByTableId(@Param("tableId") Long tableId);

    List<ProTableColumn> selectByTidNtype(@Param("tableId") Long tableId,@Param("type") String type);


    @Select("select * from pro_table_column where table_id in (select id from pro_table where database_id in (select database_id from pro_project_database_rel where project_id=#{projectId}))")
    @ResultMap("BaseResultMap")
    List<ProTableColumn> selectByProjectId(@Param("projectId") Long projectId);
}